package map;

import java.util.HashMap;
import java.util.Map;

public class Test1 {
    public static void main(String[] args) {
        Map<String , String> map = new HashMap<>();
        //添加元素
        map.put("01","张三");
        map.put("02","李四");
        System.out.println(map);
        System.out.println("==================");
        //删除元素
        map.remove("01");
        System.out.println(map);
        System.out.println("==================");
        //移除元素
        map.clear();
        System.out.println(map);
        System.out.println("==================");
        //判断键
        map.put("01","张三");
        map.put("02","李四");
        boolean key1 = map.containsKey("02");
        boolean key2 = map.containsKey("03");
        System.out.println(key1);
        System.out.println(key2);
        System.out.println("==================");
        //判断值
        boolean value1 = map.containsValue("张三");
        boolean value2 = map.containsValue("aaa");
        System.out.println(value1);
        System.out.println(value2);
        System.out.println("==================");
        //集合是否为空
        boolean empty = map.isEmpty();
        System.out.println(empty);
        System.out.println("==================");
        //长度
        int size = map.size();
        System.out.println(size);
    }
}

